package com.corx.network.mysqlstorage.repository;


import com.corx.network.mysqlstorage.common.PageQuery;
import com.corx.network.mysqlstorage.common.PageResult;
import com.corx.network.mysqlstorage.model.DeviceDataStructured;
import com.corx.network.mysqlstorage.model.DeviceModelField;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * @author gx
 * @version 1.0.0
 */
public interface DeviceDataStructuredRepository {

    public Optional<DeviceDataStructured> findLatestOne(String tableName, Map<String, Object> model);

    PageResult<DeviceDataStructured> findByPage(String tableName, Map<String, Object> model, PageQuery pageQuery);

    void delete(String tableName, Long id);

    void ensureStructuredTable(String tableName, List<DeviceModelField> fields);

    void insertStructuredData(String tableName, String deviceId,Long modelId, List<DeviceModelField> fields, String rawJson);


}
